﻿function liFormat(row, i, num) {
    var result = '<table width=100%><tr><td class="li">'+row[0]+'</td><td class="qnt">' + row[3] + '</td></tr></table>';
    return result;
}
function selectItem(li) {
//    if (li == null) var sValue = 'А ничего не выбрано!';
//    if (!!li.extra) var sValue = li.extra[2];
//    else var sValue = li.selectValue;
    //alert("Выбрана запись с ID: " + sValue);
}

$("#SrcAddress").autocomplete("autocompleteaddress.wcmd", {
    delay: 400,
    minChars: 3,
    matchSubset: false,
    autoFill: true,
    matchContains: false,
    cacheLength: 1,
    selectFirst: true,
    formatItem: liFormat,
    max: 20,
    onItemSelect: selectItem,
    scroll: true
});
$("#DstAddress").autocomplete("autocompleteaddress.wcmd", {
    delay: 400,
    minChars: 3,
    matchSubset: false,
    autoFill: true,
    matchContains: false,
    cacheLength: 1,
    selectFirst: false,
    formatItem: liFormat,
    max: 20,    
    onItemSelect: selectItem
});